import '@/style/comm.css'
import './index.css'
import bluesan from '@/imgs/bluesan.png';
import huisan from '@/imgs/sanjiao.png';
import answerJson from '@/js/public/josn'

//获取问题
const answer= GetQueryString("answer")
let str=''
$.each(answerJson[answer], function (i, val) {  
    str +=`<li><i></i> ${val.title}<span class="cjwtsj"></span>
            <p>${val.content}</p>
        </li>`
});
$('.cjwt ul').append(str)

//	常见问题右侧三角
$('.cjwtsj').click(function(){
    let ishidden=$(this).next().is(":hidden")
    $(this).next().slideToggle("fast")
    if(ishidden){
        $(this).css({"background":"url("+bluesan+")",'backgroundSize': '100% 100%' })
        $(this).css("transform", "rotate(-90deg)");
    }else{
        $(this).css("transform", "rotate(0deg)");
        $(this).css({"background":"url("+huisan+")",'backgroundSize': '100% 100%'})
    } 
})

function GetQueryString(name) {
	var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if (r != null) return unescape(r[2]);
	return null;
}